class Student:
    def __init__(self, name):
        self.name = name

    def __getattr__(self, item):
        print('Accessing non-existent attribute: {}'.format(item))
        return None


stu = Student('Tom')
print(stu.score)  # 当访问未定义的 score 属性时，会打印消息并且返回 None